package org.csu.controller;

import org.csu.entity.Book;
import org.csu.entity.BookQuery;
import org.csu.entity.BorrowRequest;
import org.csu.entity.BorrowResult;
import org.csu.service.BookBorrowService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.multipart.MultipartFile;
import org.csu.vo.BaseResponse;
import org.springframework.stereotype.Controller;
import javax.annotation.Resource;

@Controller(value="bookBorrowController")
public class BookBorrowController {
    @Resource(name="bookBorrowService")
    private BookBorrowService bookBorrowService;

    public String searchBooks(BookQuery query, Integer pageNum){
        return bookBorrowService.searchBooks(query, pageNum);
    }

    public ResponseEntity<BaseResponse<BorrowResult>> borrowBook(BorrowRequest request){
        return bookBorrowService.borrowBook(request);
    }

    public String getBorrowingList(Integer pageNum){
        return bookBorrowService.getBorrowingList(pageNum);
    }

    public ResponseEntity<BaseResponse<Boolean>> applyReturn(Integer bookId){
        return bookBorrowService.applyReturn(bookId);
    }

    public ResponseEntity<BaseResponse<Boolean>> confirmReturn(Integer bookId){
        return bookBorrowService.confirmReturn(bookId);
    }

}
